// 添加厨师组件

var cooker_size = [] // 用于收集圆圈标准大小

function cooker() {
    // 是否需要给厨师标号?
    let obj = {
        free: 0, // 是否在做饭
        time: 100, // 饭菜完成时间进度条       
        food:'', // 当前正在完成的菜品 
    }
    let circle = document.createElement('div'),
        under  = document.createElement('div')
    circle.className = 'circle'
    under.className  = 'under'
    under.style.top  = '80%'
    under.style.left = '0%'
    if (cooker_size.length === 0) {
        cooker_size.push(parseInt(cook.style.height) * 0.7 + 'px')
        cooker_size.push(parseInt(cook.style.height) * 0.7 + 'px')
    }
    circle.style.width = cooker_size[0]
    circle.style.height = cooker_size[1]
    circle.style.backgroundImage = 'url(./restaurant/iconfinder_Chef-2_379358.png)'  // 引入厨师图片
    circle.style.backgroundSize = '100% 100%'
    circle.appendChild(under)
    cook.appendChild(circle)

    return obj
}


function addcooker() {
    // 添加厨师组件
    // 调用cooker并给厨师数组添加一个厨师
    if (allcooker.length === 2) {
        // 给cook设置宽高
        cook.style.width = `${x.width * 0.9}px`
        cook.style.height = `${x.height / 4}px`
        line.style.top = '78%'
        show_info_custom[0].style.top = '60%'
        show_info_custom[1].style.top = '60%'
        show_info_custom[2].style.top = '70%'
        show_info_custom[3].style.top = '70%'
        show_info_custom[0].style.top = '0%'
        show_info_custom[1].style.top = '0%'
        show_info_custom[2].style.top = '0%'
        show_info_custom[3].style.top = '0%'
        small_tip.style.top = '45%'
        clearInterval(customsetin)
        setInterval(() => {
            // 添加顾客队列
            Custom()
            // 后续应该在这里添加耐心值?
        }, 7000) // 更变为7秒一个顾客
    }
    cook.removeChild(addtbn)
    allcooker.push(cooker())
    if(allcooker.length <= 5){
        cook.appendChild(addtbn)
    }
    
    S_Tips(`雇佣成功，当前有${allcooker.length}名厨师`)
}